package comjava;

public class RunnableDayin implements Runnable {
    //处理的数据写在成员变量
    private String content;

    public RunnableDayin(String content) {
        this.content = content;
    }

    private boolean sw = true;
    @Override
    public void run() {
//        处理的业务
        while (sw){
            System.out.println(Thread.currentThread().getName()+":"+content);
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public void close(){
        this.sw = false;
    }
}
